package com.gnerv.pabu.plugin.utils;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile;

import java.util.HashMap;
import java.util.Map;

public class TemMapUtils {

    public static Map getMap(AnActionEvent anActionEvent, String className){
        VirtualFile virtualFile = anActionEvent.getData(CommonDataKeys.VIRTUAL_FILE);
        Project project = anActionEvent.getData(CommonDataKeys.PROJECT);
        String packageName = ProjectRootManager.getInstance(project).getFileIndex().getPackageNameByDirectory(virtualFile);
        Map<String, Object> hashMap = new HashMap<>(16);
        hashMap.put("package", packageName);
        hashMap.put("className", className);
        hashMap.put("classNameLowercase", NameUtils.classNameLowercase(className));
        return hashMap;
    }

}
